/*
 *  Copyright 2008-2010 www.jrails.org
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package org.rails.extjs.panel.grid.column;

import org.rails.extjs.AbsBase;
import org.rails.extjs.javascript.Function;
import org.rails.extjs.javascript.JavaScript;

public class ActionColumnItem extends AbsBase {

	public ActionColumnItem() {
		super();
	}
	
	public ActionColumnItem(String icon,Function handler) {
		super();
		setIcon(icon);
		setHandler(handler);
	}

	public void setIcon(String icon){
		addOption("icon",icon);
	}
	
	public String getIcon(){
		return getString("icon","http://extjs.com/s.gif");
	}
	
	public void setIconCls(String iconCls){
		addOption("iconCls",iconCls);
	}
	
	public String getIconCls(){
		return getString("iconCls","");
	}
	
	public void setGetClass(Function getClass){
		addOption("getClass",getClass);
	}
	
	public Function getGetClass(){
		return (Function)getOption("getClass");
	}
	
	public void setHandler(Function handler){
		addOption("handler",handler);
	}
	
	public Function getHandler(){
		return (Function) getOption("handler");
	}
	
	public void setTooltip(String tooltip){
		addOption("tooltip",tooltip);
	}
	
	public String getTooltip(){
		return getString("tooltip","");
	}
	
	public void setScope(JavaScript scope){
		addOption("scope",scope);
	}
	
	public JavaScript getScope(){
		return (JavaScript)getOption("scope");
	}
	
	@Override
	public String getScript() {
		return option.createJson();
	}

}
